Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
cli-spinner
Advanced tools
The cli-spinner npm package is a simple and customizable spinner for command-line interfaces. It helps to indicate that a process is ongoing, providing a visual cue to users that something is happening in the background.
Basic Spinner
This feature allows you to create a basic spinner that shows a rotating animation in the terminal. The spinner can be customized with different characters.
const Spinner = require('cli-spinner').Spinner;
const spinner = new Spinner('processing.. %s');
spinner.setSpinnerString('|/-\\');
spinner.start();
setTimeout(() => spinner.stop(true), 5000);
Custom Spinner Strings
This feature allows you to use predefined spinner strings by passing an index to the setSpinnerString method. Each index corresponds to a different spinner animation.
const Spinner = require('cli-spinner').Spinner;
const spinner = new Spinner('loading.. %s');
spinner.setSpinnerString(18);
spinner.start();
setTimeout(() => spinner.stop(true), 5000);
Spinner with Custom Interval
This feature allows you to set a custom delay interval for the spinner animation, making it faster or slower depending on your needs.
const Spinner = require('cli-spinner').Spinner;
const spinner = new Spinner('waiting.. %s');
spinner.setSpinnerString('|/-\\');
spinner.setSpinnerDelay(100);
spinner.start();
setTimeout(() => spinner.stop(true), 5000);
Ora is a more feature-rich spinner for command-line interfaces. It offers more customization options, such as different spinner styles, colors, and text. Ora also supports promises, making it easier to integrate with asynchronous operations.
Cli-spinners is a collection of various spinner animations for use in command-line interfaces. It provides a wide range of spinner styles that can be easily integrated into your CLI applications. Unlike cli-spinner, it focuses more on providing a variety of spinner animations rather than customization.
Elegant-spinner is a minimalistic spinner for command-line interfaces. It provides a simple API for creating spinners with a focus on elegance and simplicity. It is less customizable compared to cli-spinner but is very lightweight and easy to use.
A simple spinner for node cli.
This package is available on npm as cli-spinner
.
npm install cli-spinner
var Spinner = require('cli-spinner').Spinner;
var spinner = new Spinner('processing.. %s');
spinner.setSpinnerString('|/-\\');
spinner.start();
var obj = new Spinner('processing.. %s')
var obj = new Spinner({
text: 'processing.. %s',
stream: process.stderr,
onTick: function(msg){
this.clearLine(this.stream);
this.stream.write(msg);
}
})
Create a new spinner object. The advanced options can be used in any combination, none of them are required.
obj.start()
Starts the spinner.
obj.stop(clean)
Stops the spinner. Accepts a Boolean parameter to clean the console.
obj.isSpinning()
Returns true/false depending on whether the spinner is currently spinning.
obj.setSpinnerString(spinnerString)
Sets the spinner string. Accepts either a String or an Integer index to reference the built-in spinners.
obj.setSpinnerDelay(spinnerDelay)
Sets the spinner animation speed.
obj.setSpinnerTitle(spinnerTitle)
Sets the spinner title. Use printf-style strings to position the spinner.
Spinner.setDefaultSpinnerString(spinnerString)
Sets the default spinner string for all newly created instances. Accepts either a String or an Integer index to reference the built-in spinners.
Spinner.setDefaultSpinnerDelay(spinnerDelay)
Sets the default spinner delay for all newly created instances.
To see a demonstration of the built-in spinners, point your console at the example
folder and run:
node spinner.js
FAQs
A simple spinner
The npm package cli-spinner receives a total of 271,061 weekly downloads. As such, cli-spinner popularity was classified as popular.
We found that cli-spinner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.